# coding:utf-8
import os
import yaml
from eve import Eve
import domain

ospath = os.path.split(__file__)[0]
run_mode = os.environ.get('RUN_ENV', 'local')

settings = yaml.load(open(ospath + '/config/eve.yml', 'r'))
mongo = yaml.load(open(ospath + '/config/srv.yml', 'r'))[run_mode]['mongo']

settings.update({
    'DOMAIN': domain.domains,
    'MONGO_PORT': mongo['port'],
    'MONGO_HOST': mongo['host'],
    'MONGO_DBNAME': mongo['dbname'],
    'MONGO_USERNAME': mongo['username'],
    'MONGO_PASSWORD': mongo['password']
})

app = Eve(settings=settings)

if __name__ == '__main__':
    app.run()
